<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
<!--     <link rel="shortcut icon" href="../../assets/ico/favicon.png"> -->

    <title>Listado de Profesores</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap-3.1.1.css" rel="stylesheet" media="screen">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="../../assets/js/html5shiv.js"></script>
      <script src="../../assets/js/respond.min.js"></script>
    <![endif]-->
  </head>
<script>
function mostrarMensaje(){
	  resultado = "${resultado}";
	  if(resultado != ""){
		  alert(resultado);
		  resultado="";
	  }  
}
</script>
  <body onload="mostrarMensaje();">
        
	  <!-- Static navbar -->
	  <div class="navbar navbar-default navbar-static-top">
	    <div class="container">
	      <div class="navbar-header">
	        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
	          <span class="icon-bar"></span>
	          <span class="icon-bar"></span>
	          <span class="icon-bar"></span>
	        </button>
	        <a class="navbar-brand" href="principal.jsp">JAVAMAN</a>
	      </div>
	      <div class="navbar-collapse collapse">
	        <ul class="nav navbar-nav">
	          <li><a href="principal.jsp">Inicio</a></li>
	          <li class="dropdown active">
	            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Mantenimientos <b class="caret"></b></a>
	            <ul class="dropdown-menu">
	              <li><a href="LoadRegistrarProfesorServlet?accion=listar">Profesores</a></li>	 
	              <li><a href="LoadRegistrarCategoriaServlet?accion=listar">Categorias</a></li>	                         
	            </ul>
	          </li>
	          <li><a href="#">Reportes</a></li>	          
	          <li><a href="LogoutServlet">Salir</a></li>
	        </ul>
	      </div><!--/.nav-collapse -->
	    </div>
	  </div>
      
	 <div class="container"> 


		<p><strong>Mantenimiento de Profesores &gt; Buscar</strong></p>
		
		<form id="form1" name="form1" method="post" action="ProfesorServlet" class="form-horizontal" role="form">
		  <p>Buscar:
		  	<select name="campo">
				<option value ="nombres">Nombres</option>
				<option value ="paterno">Ap.Paterno</option>
				<option value ="materno">Ap.Materno</option>
			</select>
		    <label>
		    <input type="text" name="criterio" id="criterio" required/>
		    </label>
		    <label>
		    <input type="submit" name="button" id="button" value="Buscar" />
		    </label>
		    <label>
		    <input type="button" name="button2" id="button2" value="Nuevo" onclick="window.location='LoadRegistrarProfesorServlet?accion=insertar' "  />
		    </label>
		  </p>
		</form>
		<div class="table-responsive">
		<table width="550" height="65" border="1" cellpadding="0" cellspacing="0" class="table table-hover">
		  <tr>
		    <th width="192" scope="col">Nombre</th>
		    <th width="107" scope="col">Paterno</th>
		    <th width="192" scope="col">Materno</th>
		    <th width="192" scope="col">Editar</th>
		    <th width="192" scope="col">Publicaciones</th>
		    <th width="192" scope="col">Eliminar</th>
		  </tr>
		  <c:if test="${fn:length(arrListado) == 0}">
			   <tr>
			     <th colspan="5">No hay profesores registrados.</th>
			   </tr>
		  </c:if>	
		  <c:if test="${fn:length(arrListado) > 0}">
				<c:forEach var="vararrlistado" items="${arrListado}">
					<tr>
	   					<td>  
	 						<c:out value="${vararrlistado.nombres}"/>
	 					</td>
	 					<td>
	 						<c:out value="${vararrlistado.paterno}"/>
	 					</td>
	 					<td>
	 						<c:out value="${vararrlistado.materno}"/>
	 					</td>
						<td align="center">
							<a href="LoadRegistrarProfesorServlet?accion=modificar&idprofesor=${vararrlistado.idusuario}">
								Editar
							</a>
						</td>
						<td align="center">
							<a href="PublicacionServlet?idprofesor=${vararrlistado.idusuario}">
								Ver
							</a>
						</td>
						<td align="center">
							<a href="LoadRegistrarProfesorServlet?accion=eliminar&idprofesor=${vararrlistado.idusuario}">
								Eliminar
							</a>
						</td>
					</tr>
				</c:forEach>
			  </c:if>	
		</table>
		</div>
 		<!-- Site footer -->
	   <div class="footer">
	   	 <p>&nbsp;</p>
	     <p>&copy; RCondezo 2014 </p>
	   </div>
	   
	 </div> <!-- /container -->
  

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    
     <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-1.10.2.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap-3.1.1.js"></script>
  </body>
</html>
